#ifndef RIGHTWIDGET_H
#define RIGHTWIDGET_H

#include <QtCore>
#include <QtGui>

extern QStringList glstSector;
extern QString gactiveSector;

typedef struct _tHardwareParm
{
    QString eth0Ip;
    QString eth0Mac;
    QString eth0NetMask;

    QString eth1Ip;
    QString eth1Mac;
    QString eth1NetMask;

    QString can0Bitrate;
    QString can1Bitrate;

    QString switchAddr;
    QString switchType;

    QString srl1Bitrate;
    QString srl1Charbits;
    QString srl1stopbits;
    qint32 srl1Parity;

    QString srl2Bitrate;
    QString srl2Charbits;
    QString srl2stopbits;
    qint32 srl2Parity;

    QString srl3Bitrate;
    QString srl3Charbits;
    QString srl3stopbits;
    qint32 srl3Parity;

    QString srl4Bitrate;
    QString srl4Charbits;
    QString srl4stopbits;
    qint32 srl4Parity;
}HardwareParm;

extern HardwareParm ghardware;

typedef struct _tDevicePoint
{
    QList<quint32> lstAi;
    QList<quint32> lstDi;
    QList<quint32> lstPi;
    QList<quint32> lstDo;
    QList<quint32> lstAo;
    QList<quint32> lstAction;
    QList<quint32> lstAlarm;
}DevicePoint;

extern QMap<QString,DevicePoint*> gDeviceType;

extern QMap<quint32,QString> gDevice;

extern QMap<quint32,DevicePoint*> gPoints;

extern bool gCanDevice;

typedef struct _tHy103Cpu
{
    qint32 devId;
    QList<quint32> lstAi;
    QList<quint32> lstDi;
    QList<quint32> lstPi;
    QList<quint32> lstDo;
    QList<quint32> lstAo;
    QList<quint32> lstAction;
    QList<quint32> lstAlarm;
}Hy103Cpu;

extern QMap<quint32,Hy103Cpu*> gHy103Cpu;

typedef struct _tDeviceProtocol
{
    quint32 id;
    QString type;
    QString devNode;
}DeviceProtocol;

extern QList<DeviceProtocol*> gDeviceProtocol;

class RightWidget : public QWidget
{
    Q_OBJECT
public:
    RightWidget(const QString& path,QWidget *parent = 0);
    virtual ~RightWidget();

signals:
    void sigModified();

public slots:
    virtual void deviceChanged();

public:
    bool fileValid(){return m_bInitValid;}
    virtual bool init(){return false;}
    virtual bool updateParm(){return false;}

    virtual bool save(){return false;}

    void setPath(const QString& path){m_path=path;}

protected:
    QString m_path;

    bool m_bInitValid;
};

#endif // RIGHTWIDGET_H
